﻿using System.Configuration;

namespace Altairis.Web.Management.Configuration {
    class ManagementSection : ConfigurationSection {
        private const string ConfigurationPath = "altairis.web/management";

        public static ManagementSection GetCurrentOrDefault() {
            return (ConfigurationManager.GetSection(ConfigurationPath) as ManagementSection) ?? new ManagementSection();
        }

        [ConfigurationProperty("hostRedirector", IsRequired = false)]
        public HostRedirectorElement HostRedirector {
            get { return (HostRedirectorElement)this["hostRedirector"]; }
            set { this["hostRedirector"] = value; }
        }

        [ConfigurationProperty("sslRedirector", IsRequired = false)]
        public SslRedirectorElement SslRedirector {
            get { return (SslRedirectorElement)this["sslRedirector"]; }
            set { this["sslRedirector"] = value; }
        }

        [ConfigurationProperty("exceptionMailer", IsRequired = false)]
        public ExceptionMailerElement ExceptionMailer {
            get { return (ExceptionMailerElement)this["exceptionMailer"]; }
            set { this["exceptionMailer"] = value; }
        }

        [ConfigurationProperty("errorPages", IsRequired = false)]
        public ErrorPagesElement ErrorPages {
            get { return (ErrorPagesElement)this["errorPages"]; }
            set { this["errorPages"] = value; }
        }

        [ConfigurationProperty("urlRewriting", IsRequired = false)]
        public UrlRewritingElement UrlRewriting {
            get { return (UrlRewritingElement)this["urlRewriting"]; }
            set { this["urlRewriting"] = value; }
        }

    }
}
